import requests
import time
import execjs

#运行js文件
def js_path(js_path1,js_fnuction,js_args=None):
    with open(js_path1,"r",encoding="utf-8")as f:
        js=f.read()
        #编译js文件
        js_tex=execjs.compile(js)
        # 执行js文件
        result=js_tex.call(js_fnuction,js_args)
    return result


def prase_url(url,header,data):
    response=requests.post(url,headers=header,data=data)
    return response






def main():
    """主要的业务逻辑"""
    pwd=js_path("./01.js","m",123456789)
    # url
    url="https://mp.weixin.qq.com/cgi-bin/bizlogin?action=startlogin"
    header={
        "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"

    }
    data={
    "username": '12554552522',
    'pwd':pwd,
    'imgcode':"",
    'f': 'json',
    'userlang': 'zh_CN',
    'redirect_url':'',
    'token':'',
    'lang': 'zh_CN',
    'ajax': "1"
    }
    # 发送请求获取响应
    response=prase_url(url, header, data)
    print(response.json())
    # 数据的提取
    # 保存



if __name__ == '__main__':
    main()